<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script>
	var ws;
	function hello(){
		//创建webSocket对象
		ws = new WebSocket("ws://localhost:8080/hello");
		ws.onopen=function(){
			console.log("连接成功");
		};
		ws.onmessage=function(eve){
			console.log("收到消息："+eve.data);
		};
		ws.onerror=function(){
			console.log("连接失败！");
		};
		ws.onclose=function(){
			console.log("连接关闭！");
		};
	}

</script>
<title>Insert title here</title>
</head>
<body>

1111111111
<input type="button" value="测试" onclick="hello()">
</body>
</html>